import { PageEnum } from '@/enums/pageEnum'
import { LAYOUT } from '@/router/constant'

import type { AppRouteRecordRaw } from '@/router/types'
import type { AppRouteModule } from '@/router/types'

// 根路由
export const RootRoute: AppRouteRecordRaw = {
  path: '/',
  name: 'Root',
  redirect: PageEnum.BASE_LOGIN,
  meta: {
    title: 'Root',
  },
}

export const LoginRoute: AppRouteRecordRaw = {
  path: '/login',
  name: 'Login',
  component: () => import('@/views/base/login/Login.vue'),
  meta: {
    title: '登录',
  },
}

const DashboardRoutes: AppRouteModule = {
  path: '/project',
  name: 'Project',
  component: LAYOUT,
  parentId: 0,
  redirect: '/project/instock',
  meta: {
    orderNo: 10,
    icon: 'ant-design:home-outlined',
    title: '首页',
  },
  children: [
    {
      path: 'instock',
      name: 'InStock',
      component: () => import('@/views/project/instock/index.vue'),
      meta: {
        // affix: true,
        title: '入库',
        icon: 'ant-design:bar-chart-outlined',
      },
    },
  ]
}

// Basic routing without permission
// 未经许可的基本路由
export const basicRoutes = [
  RootRoute,
  LoginRoute,
  DashboardRoutes,
]
